;;; GNU Guix --- Functional package management for GNU
;;;
;;; Copyright © 2022 jgart <jgart@dismail.de>
;;; This file is not part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (guixrus packages rnr)
  #:use-module (guix build-system copy)
  #:use-module (guix build-system python)
  #:use-module (guix build-system pyproject)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix gexp)
  #:use-module (gnu packages libusb)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages security-token)
  #:use-module (gnu packages check)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-check)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-crypto)
  #:use-module (gnu packages python-science)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages sphinx)
  #:use-module (gnu packages time)
  #:use-module (gnu packages python-xyz)
  #:use-module ((guixrus licenses) #:prefix license:))

(define-public python-fuzzyfinder
  (package
    (name "python-fuzzyfinder")
    (version "2.1.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "fuzzyfinder" version))
              (sha256
               (base32
                "0jzh68qr9nwgp9zchbzqq0qhihinf27m3iwhcsnyqsw623qqcvf5"))))
    (build-system python-build-system)
    (native-inputs (list python-pytest))
    (home-page "https://github.com/amjith/fuzzyfinder")
    (synopsis "Fuzzy Finder implemented in Python.")
    (description "Fuzzy Finder implemented in Python.")
    (license license:bsd-3)))

(define-public rnr
  (package
    (name "rnr")
    (version "1.0.10")
    (source 
      (origin
        (method git-fetch)
        (uri 
          (git-reference 
            (url "https://github.com/bugnano/rnr")
            (commit version)))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "1swi8qzjccg3wr1465n9gm7hnd4i7dhw21mfw44qw0ni78f9nbg7"))))
    (build-system python-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-a2x-executable
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* '("setup.py")
                (("a2x")
                 (search-input-file inputs "/bin/a2x")))))
          (add-before 'check 'set-homeless-shelter
            (lambda* (#:key inputs #:allow-other-keys)
              (setenv "HOME" "/tmp"))))))
    (inputs (list asciidoc))
    (propagated-inputs 
      (list python-atomicwrites 
            python-fuzzyfinder
            python-pygments
            python-pyxdg
            python-urwid))
    (home-page "https://github.com/bugnano/rnr")
    (synopsis "The RNR File Manager")
    (description "The file manager that is not @code{ranger}.")
    (license license:gpl3+)))

